home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / RGASM.RAR / ASMCODE.EXE / CHAPT1-5 / HELLO5.ASM < prev    next >
Encoding:
Assembly Source File  |  1993-05-10  |  1.7 KB  |  35 lines

  1. ;
  2. ;       Program Hello5 ( Chapter 5 )
  3. ;
  4. .TITLE     Hello                             ;    title is not necessary
  5. .MODEL     SMALL                             ;    declare memory model
  6. .CODE                                        ;    declare code segment
  7. MAIN       PROC
  8.        MOV    AX,@Data                   ;    copy address of data
  9.        MOV    DS,AX                      ;    segment into DS
  10.        LEA    DX,Hello
  11.        CALL   Display_DX                 ;     call procedure
  12.        MOV    AH,4Ch                     ;     define DOS function to exit
  13.        MOV    AL,00h                     ;     with code zero
  14.        INT    21h                        ;     exit to DOS
  15.         ;----------------------------!
  16.         ;     Procedure section      !
  17.         ;----------------------------!
  18. Display_DX PROC                              ;     declare procedure Display__DX
  19.        MOV    AH,09h                     ;     define DOS function number
  20.        INT    21h                        ;     call DOS function to display
  21.                          ;     "Hello!"
  22.        RET                               ;     return to MAIN
  23. Display_DX ENDP                              ;     end of procedure
  24.         ;----------------------------!
  25.         ;End of procedure section    !
  26.         ;----------------------------!
  27. MAIN       ENDP             
  28. .DATA                                        ;     declare data segment
  29.  Hello     DB        'Hello!$'               ;     define string to display
  30.                          ;
  31. .STACK                                       ;     Declare stack segment
  32.        DB        128    DUP      (?)     ;     reserve 128 bytes for stack
  33.                          ;
  34.        END       MAIN                    ;     end of program
  35.